package com.fr.lintcode;

import java.util.Arrays;

public class Q1692 {

    /**
     * @param atk1: the power of heros
     * @param atk2: the power of monsters
     * @return: how many monsters can you kill at most?
     */
    public int getAns(int[] atk1, int[] atk2) {
        // Write your code here
    	if(atk1 == null || atk2 == null) {
    		return 0;
    	}
    	Arrays.sort(atk1);
    	Arrays.sort(atk2);
    	int n = atk1.length;
    	int index1 = 0;
    	int index2 = 0;
    	int count = 0;
    	while(index1 < n && index2 < n) {
    		if(atk1[index1] > atk2[index2]) {
    			count ++;
    			index1++;
    			index2++;
    		}else {
    			index1++;
    		}
    	}
    	return count;
    }

}
